import {mix} from "@/utils/mix";

export const buttonGenerate = (colorWeight) => {
  const buttonHoverHint = 20, buttonActiveShade = 10, buttonPlainBg = 90, buttonPlainBorder = 60;
  const { black, white, primary, success, danger, warning, info, buttonDisabledMixColor } = colorWeight;
  const colors = {primary, success, danger, warning, info};
  const result = {};

  Object.entries(colors).forEach(([key, color]) => {
    result[`--button-${key}-background-color-hover`] = mix(white, color, buttonHoverHint);
    result[`--button-${key}-border-color-hover`] = mix(white, color, buttonHoverHint);
    result[`--button-${key}-background-color-active`] = mix(black, color, buttonActiveShade);
    result[`--button-${key}-border-color-active`] = mix(black, color, buttonActiveShade);
    result[`--button-${key}-background-color-disabled`] = mix(color, buttonDisabledMixColor);
    result[`--button-${key}-border-color-disabled`] = mix(color, buttonDisabledMixColor);
    result[`--button-${key}-background-color-plain`] = mix(white, color, buttonPlainBg);
    result[`--button-${key}-border-color-plain`] = mix(white, color, buttonPlainBorder);
    result[`--button-${key}-background-color-active`] = mix(black, color, buttonActiveShade);
    result[`--button-${key}-border-color-active`] = mix(black, color, buttonActiveShade);
  })

  return result;
}
